home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crosscountry USA Photo Safari
/
Crosscountry USA Photo Safari.iso
/
Data
/
cc_base
/
pak00_16bit_f.pk3
/
eat.tab.p
< prev
next >
Wrap
Text File
|
2003-01-03
|
14KB
|
389 lines
{
X = 601;
Y = 65;
state = 0;
rest_x = 601;
expand_x = 400;
Hidden = 1;
ChildID = {
GuiLayer("eat_layer") {
X = 0;
Y = 0;
ChildID = {
GuiAnimation("plate") {
X = 39;
AnimationID = "gui/dash/tab/plate/plate.pcx";
Width = 240;
Height = 180;
},
GuiTextInput("hunger_message") {
X = 45;
Y = 10;
InputDisabled = TRUE;
WordWrap = TRUE;
Width = 180;
Height = 44;
FontID = "font/verdana_9.tf";
ScriptID = Script {
@animate {
resid Player;
resid Game;
resid hunger_data_id;
int row_count;
str hunger_state;
int last_ate;
int time;
int hunger;
int message_row;
hunger_data_id = ResPropGetResID(ResByName("CSVData"), "hunger_id");
Game = ResByName("Game");
Player = ResPropGetResID(Game,"game_cur_player");
/* if we can stop here, show appropriate options below */
if (ResPropGetInt(Player,"nav_can_eat") == 1) {
ResPropSetInt(GuiSiblingByName("can_eat_layer"),"Hidden",FALSE);
ResPropSetInt(GuiSiblingByName("cannot_eat_layer"),"Hidden",TRUE);
} else {
ResPropSetInt(GuiSiblingByName("can_eat_layer"),"Hidden",TRUE);
ResPropSetInt(GuiSiblingByName("cannot_eat_layer"),"Hidden",FALSE);
}
last_ate = ResPropGetInt(Player,"player_last_meal");
time = ResPropGetInt(Player,"time_now");
last_ate = ((time - last_ate) / 60) / 60;
hunger = ResPropGetInt(Player,"player_hunger");
row_count = CSVGetRowCount(hunger_data_id);
message_row = (row_count * hunger) / ResPropGetInt(Game,"game_hunger_limit");
if (message_row > (row_count-1)) {
message_row = row_count -1;
}
hunger_state = CSVGetStr(hunger_data_id,"phrase",message_row);
ResPropSetStr(SELF,"InputText",
StrFormatStr(
MangleSIDToStr(61/*"You last ate %d hours ago. %s."*/),
last_ate,
hunger_state
)
);
}
};
},
GuiAnimation("line") {
AnimationID = "gui/dash/tab/line/line.pcx";
Y = 48;
X = 45;
},
GuiLayer("can_eat_layer") {
X = 48;
Y = 53;
ChildID = {
GuiButton("eat_button") {
X = 45;
Y = 40;
TextID = Mangle(62/*"Eat Here"*/);
StyleID = "gui/dash/tab/button/tab.gbs";
FontID = "font/tab_button.tf";
Width = 80;
AutoSize = Height;
ScriptID = Script {
@activate {
resid Player;
resid Game;
resid RouteData;
resid csv_data_id;
resid city_data_id;
resid state_data_id;
resid Message;
str city;
int meal_cost;
int tax;
int city_row;
int time_now;
str state_abbrev;
Game = ResByName("Game");
Message = ResByName("dash.gl/message");
csv_data_id = ResByName("CSVData");
city_data_id = ResPropGetResID(csv_data_id, "city_id");
state_data_id = ResPropGetResID(csv_data_id, "state_id");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
city = ResPropGetStr(Player,"nav_cur_city");
meal_cost = ResPropGetInt(Game,"game_meal_cost");
ResPropAlias(Player,"time_now","time_now");
if (ResPropGetInt(Player,"player_hunger") == 0) {
ResPropSetStr(Message, "InputText", MangleSIDToStr(63/*"You are too full to eat."*/));
ResPropSetInt(Message, "timeout", CVarGetInt("framerate") * 5);
stop;
}
/* reset the last ate timer */
ResPropSetInt(Player,"player_last_meal",ResPropGetInt(Player,"time_now"));
city_row = CSVSearch(city_data_id,"name",city);
state_abbrev = CSVGetStr(city_data_id,"state",city_row);
tax = StrToInt(
CSVGetStr( state_data_id,"food_tax",
CSVSearch(state_data_id,"abbreviation",state_abbrev)
)
);
tax = tax + 10000;
meal_cost = (meal_cost * tax) / 10000;
ResPropSetStr(Player, "nav_picture", "restaurant");
ResPropSetStr(Player, "nav_sound", "restaurant");
ResPropSetInt(Player, "truck_seatbelt", 0);
ResParseEvent(ResByName("dash.gl/seatbelt"),"@show");
/* if im on the road */
if (ResPropGetInt(Player,"nav_at_city") == 0) {
ResPropSetInt(Player, "nav_picture_no_dash_flag", 1);
}
/* show the restaurant */
ResPropSetInt(ResByName("dash.gl/full_screen"), "Hidden", FALSE);
/* add time for eating */
time_now += ResPropGetInt(Game,"game_time_taken_to_eat");
ResPropSetInt(Player,"expense_spent_on_food", ResPropGetInt(Player,"expense_spent_on_food") + meal_cost);
ResPropSetInt(Player,"player_hunger",0);
ResPropSetStr(Message, "InputText",
StrFormatStr(
MangleSIDToStr(64/*"You ate at a restaurant. The meal cost you $%s."*/),
IntToDecimalStr(meal_cost,100)
)
);
ResPropSetInt(Message, "timeout", CVarGetInt("framerate") * 10);
}
}
},
GuiTextInput("eat_message") {
Y = 0;
X = 0;
InputDisabled = TRUE;
WordWrap = TRUE;
Width = 180;
Height = 44;
FontID = "font/tab_w_on_g.tf";
ScriptID = Script {
@animate {
resid Player;
resid Game;
resid RouteData;
resid csv_data_id;
resid city_data_id;
resid state_data_id;
str city;
int meal_cost;
int tax;
int city_row;
str state_abbrev;
Game = ResByName("Game");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
csv_data_id = ResByName("CSVData");
city_data_id = ResPropGetResID(csv_data_id, "city_id");
state_data_id = ResPropGetResID(csv_data_id, "state_id");
city = ResPropGetStr(Player,"nav_cur_city");
meal_cost = ResPropGetInt(Game,"game_meal_cost");
city_row = CSVSearch(city_data_id,"name",city);
state_abbrev = CSVGetStr(city_data_id,"state",city_row);
tax = StrToInt(
CSVGetStr( state_data_id,"food_tax",
CSVSearch(state_data_id,"abbreviation",state_abbrev)
)
);
tax = tax + 10000;
meal_cost = (meal_cost * tax) / 10000;
ResPropSetStr(SELF,"InputText",
StrFormatStr(
MangleSIDToStr(65/*"The cost for a meal in %s is $%s."*/),
city,
IntToDecimalStr(meal_cost,100)
)
);
}
};
}
};
},
GuiLayer("cannot_eat_layer") {
X = 48;
Y = 53;
ChildID = {
GuiTextInput("no_eat_message") {
X = 0;
Y = 0;
InputDisabled = TRUE;
WordWrap = TRUE;
Width = 180;
Height = 80;
FontID = "font/tab_w_on_g.tf";
ScriptID = Script {
@animate {
ResPropSetStr(SELF,"InputText",MangleSIDToStr(66/*"There are no restaurants here. Try driving to the next city."*/));
}
};
}
};
},
GuiAnimation("line1") {
AnimationID = "gui/dash/tab/line/line.pcx";
Y = 142;
X = 45;
},
GuiTextInput("state_tax") {
X = 45;
Y = 144;
Width = 185;
Height = 35;
WordWrap = TRUE;
InputDisabled = TRUE;
FontID = "font/verdana_9.tf";
ScriptID = Script {
@animate {
resid Player;
resid Game;
resid csv_data_id;
resid city_data_id;
resid state_data_id;
str state_name;
int state_tax;
int state_row;
str state_ab;
Game = ResByName("Game");
csv_data_id = ResByName("CSVData");
city_data_id = ResPropGetResID(csv_data_id, "city_id");
state_data_id = ResPropGetResID(csv_data_id, "state_id");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
state_ab = CSVGetStr(city_data_id,"state",CSVSearch(city_data_id,"name",ResPropGetStr(Player,"nav_cur_city")));
state_row = CSVSearch(state_data_id,"abbreviation",state_ab);
state_name = CSVGetStr(state_data_id,"name",state_row);
state_tax = CSVGetInt(state_data_id,"food_tax",state_row) / 100;
ResPropSetStr(SELF,"InputText",StrFormatStr(MangleSIDToStr(67/*"%s has a food tax of %d percent."*/), state_name, state_tax ));
}
};
}
};
},
GuiAnimation("tab") {
Y = 82;
AnimationID = "gui/dash/tab/eat/eat_off.pcx";
ScriptID = script {
@activate {
resid Parent;
resid Player;
resid Game;
Game = ResByName("Game");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
Parent = GuiParent(SELF);
if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
ResPropSetResID(Player,"truck_tab_expanded",RES_INVALID);
} else {
ResPropSetResID(Player,"truck_tab_expanded",Parent);
GuiToFront(Parent);
}
if (ResPropGetInt(Player,"nav_can_eat") == 1) {
ResParseEvent(ResByName("dash.gl/brake_pedal"),"@activate");
}
}
@animate {
resid Parent;
int state;
resid Player;
resid Game;
Game = ResByName("Game");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
Parent = GuiParent(SELF);
/* if we can stop here, highlight me */
if (ResPropGetInt(Player,"nav_can_eat") == 1) {
if (ResPropGetInt(Player,"player_hunger") <= 100 ) {
ResPropSetResID(SELF,"AnimationID",ResByName("gui/dash/tab/eat/eat_off.pcx"));
} else {
ResPropSetResID(SELF,"AnimationID",ResByName("gui/dash/tab/eat/eat_on.pcx"));
}
} else {
ResPropSetResID(SELF,"AnimationID",ResByName("gui/dash/tab/eat/eat_off.pcx"));
}
if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"expand_x"));
ResPropSetInt(GuiSiblingByName("eat_layer"),"Hidden",FALSE);
} else {
ResPropSetInt(GuiSiblingByName("eat_layer"),"Hidden",TRUE);
ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"rest_x"));
}
}
}
},
GuiAnimation("guage") {
AnimationID = "gui/dash/tab/tab_gauge/tab_gauge.anm";
Y = 85;
X = 5;
ScriptID = script {
@animate {
resid Player;
resid Game;
int frame_count;
int player_hunger;
int frame;
Game = ResByName("Game");
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
frame_count = ResPropGetInt(SELF, "FrameCount");
player_hunger = ResPropGetInt(Player,"player_hunger");
frame_count -= 1;
frame = (frame_count * player_hunger) / ResPropGetInt(Game,"game_hunger_limit");
frame = frame_count - frame;
if (frame < 0) {
frame = 0;
}
ResPropSetInt(SELF,"CurrentFrame",frame);
}
};
}
};
}